package com.xiaofang.controller;

import com.xiaofang.mapper.ProvincesMapper;
import com.xiaofang.pojo.Provinces;
import com.xiaofang.pojo.Title;
import com.xiaofang.pojo.dto.TitleDto;
import com.xiaofang.serivce.TitleSerivce;
import com.xiaofang.utils.Ajax;
import com.xiaofang.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: xiaofangbackend
 * @ClassName LoginSuccess
 * @description:
 * @author: aodi
 * @create: 2025-06-20 17:19
 * @Version 1.0
 */
@RestController
@RequestMapping("/xiaofang/query")
public class LoginSuccessController {

    @Autowired
    private TitleSerivce titleSerivce ;


    @Autowired
    private ProvincesMapper provincesMapper ;

//    查询全部省份
    @GetMapping("/queryAllProvinces")
    public Ajax queryAllProvinces(){
        List<Provinces> provinces = provincesMapper.getProvinces();
        return new Ajax("200","查询成功",provinces);
    }


//     多条件查询
    @PostMapping("/queryList")
    public Ajax queryList(@RequestBody TitleDto title)
    {
        System.out.println("title = " + title);
        Page<Title> titles = titleSerivce.getTitle(title);


        return  new Ajax("200","查询成功",titles);
    }
}
